//仓库模块
var warehouse = function(){
    var gl;
    var createGridList = function(id){
        var cm = new Ext.grid.ColumnModel([{
            xtype: 'gridcolumn',
            dataIndex: 'c1',
            header: '名称'
        }, {
            xtype: 'gridcolumn',
            dataIndex: 'c2',
            header: '货单号'
        }, {
            xtype: 'gridcolumn',
            dataIndex: 'c3',
            header: '供应商'
        }, {
            xtype: 'gridcolumn',
            dataIndex: 'c4',
            header: '规格'
        }, {
            xtype: 'gridcolumn',
            dataIndex: 'c5',
            header: '型号'
        }, {
            xtype: 'gridcolumn',
            dataIndex: 'c6',
            header: '用途'
        }, {
            xtype: 'gridcolumn',
            dataIndex: 'c7',
            header: '数量'
        }, {
            xtype: 'gridcolumn',
            dataIndex: 'c8',
            header: '单价(元)',
            renderer: function(v){
                return '<span style="color:#FF0000;">￥' + v + "</span>";
            }
        }, {
            xtype: 'gridcolumn',
            dataIndex: 'c9',
            header: '总价(元)',
            renderer: function(v){
                return '<span style="color:#FF0000;">￥' + v + "</span>";
            }
        }, {
            xtype: 'gridcolumn',
            dataIndex: 'c10',
            id: 'c10',
            header: '备注'
        }]);
        
        var gp = new Ext.grid.GridPanel({
            id: id,
            closable: true,
            title: '库存清单',
            cm: cm,
            store: new Ext.data.JsonStore({
                autoDestroy: true,
                url: 'data/data2.json',
                root: 'ds',
                autoLoad: true,
                idProperty: 'id',
                fields: ['c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'c10']
            }),
            autoExpandColumn: 'c10',
            loadMask: true,
            stripeRows: true
        });
        return gp;
    };
    return {
        grid: function(id){
            gl = createGridList(id);
            return gl;
        }
    };
}();
